<template>

		<uni-section class="top_title" title="案例汇总" type="line">
			<!-- <view class="example-body">
				<uni-fav :checked="checkList[4]" :content-text="contentText" @click="favClick(4)" />
			</view> -->
			<view class="example-body">
			<button class="mini-btn" style="background-color:#007aff; color:white;" size="mini" @click="goMyPage()">我的</button>
			</view>

			<uni-list>
				<view v-for="(i, index) in suggestion" :key="index" @click="goDetail(i)">
					<uni-list-item :title="i.title" :note="i.classone" showArrow thumb="/static/images/tabbar/work.png"
						thumb-size="base" rightText="查看详情" />
				</view>
			</uni-list>

			<view class="floatbtn">
				<uni-fab ref="fab" :pattern="pattern" :horizontal="horizontal" :popMenu="false" :vertical="vertical"
					:direction="direction" @fabClick="fabClick" />
			</view>
		</uni-section>

	
</template>

<script>
	export default {
		data() {
			return {
				suggestion: []
			}
		},
		methods: {
			goDetail(e){
				uni.navigateTo({
					url:"/pages/work/caseAlldetail?id="+ e.id + "&title=" + e.title + "&state=" + e.state
				})
			},
			favClick(index) {
				this.checkList[index] = !this.checkList[index]
				console.log(this.checkList[index]);
				this.$forceUpdate()
			},
			goMyPage(){
				uni.navigateTo({
					url:'/pages/work/caseMy'
				});
			},
			fabClick() {
				uni.navigateTo({
					url: '/pages/work/caseSubmit'
				});
			},
			onShow() {
				var _this = this;
				uni.getStorage({
					key: 'App-Token',
					success(res) {
						_this.token = res.data;
						uni.request({
							url: 'http://xg.kystu.cn:8085/system/example_kt/list',
							method: "GET",
							data:{state:"1"},
							header: {
								'Authorization': "Bearer " + _this.token
							},
							success: (res) => {
								if (res.data
									.code ==
									200) {
									// uni.showToast({
									// 	title: "查询成功",
									// 	icon: 'exception',
									// 	duration: 850
									// });
									console.log(res.data.rows)
									_this.suggestion = res.data.rows;
								}
							}
						});
					}
				})
			}
		}
	}
</script>

<style>
	.top_title{
		margin-top: 200px;
		
	}
	.example-body {
		display: flex;
		margin-top: -35px;
		margin-left: 80%;
		/* padding: 100px 15px; */
	}

	/* #ifdef MP-ALIPAY */
	.uni-fav {
		margin-left: 20rpx;
	}

	/* #endif */


	.favBtn {
		margin: 0 20rpx 20rpx 0;
	}


	.example-body-fullWidth {
		padding: 32rpx 0;
	}

	.example-body-first {
		/* #ifndef APP-PLUS-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: flex-start;
	}

	.favBtn-nav {
		// left:-50rpx;
	}

	.floatbtn {
		position: fixed;
		display: flex;
		flex-direction: column;
		right: 55px;
		bottom: 80px;
		z-index: 10;
		padding: 2px 2px 0 2px;
		border-radius: 3px;
		/*    width: 150px; */
	}
</style>
